<!DOCTYPE html>
<html lang="en">
	<head>
    	<meta name="layout" content="main_pc">
        <title>火堆工作台</title>       
        <link rel="stylesheet" href="${resource(dir: 'css', file: 'user.center.css')}" type="text/css">
        <link rel="stylesheet" href="${resource(dir: 'css_pc', file: 'project.css')}" type="text/css">
        <link rel="stylesheet" type="text/css" href="${resource(dir: 'editerPlugin/simditor-2.2.4/styles', file: 'simditor.css')}" />
        <script type="text/javascript" src="${resource(dir: 'editerPlugin/simditor-2.2.4/lib', file: 'module.js')}"></script>
	    <script type="text/javascript" src="${resource(dir: 'editerPlugin/simditor-2.2.4/lib', file: 'hotkeys.js')}"></script>
	    <script type="text/javascript" src="${resource(dir: 'editerPlugin/simditor-2.2.4/lib', file: 'uploader.js')}"></script>
	    <script type="text/javascript" src="${resource(dir: 'editerPlugin/simditor-2.2.4/lib', file: 'simditor.js')}"></script>
		<script type="text/javascript" src="${resource(dir: 'js', file: 'jquery-1.10.2.js')}"></script>
	    <script type="text/javascript" src="${resource(dir: 'js', file: 'ajaxfileupload.js')}"></script>
    </head>
<body>

	<div class="container-fluid">

		<section class="quick-navi mb20">
			<div class="container">
				<a href="#" class="quick-link"><span>火堆工作台</span><span
					class="caret"></span></a>
				<!--a href="#" class="quick-link">联系我们</a-->
			</div>
		</section>

		<section>
			<div class="container mb50">
				
				<g:render template="navigate"   model="[status: status]"/>
							

				<div class="right-content" id="rightconsole">

					<div class="launch-container">
                <h1>编辑文章</h1>
                <div class="content">
	                <div class="form-item fix-width">
	                <div style="line-height: 25px; padding: 10px 0px 10px 0px"><button onclick="window.location.href='/scfire/manage/editAbout'">关于火堆</button>  <button onclick="window.location.href='/scfire/manage/editJoinUs'">加入我们</button> </div>
	                </div>
                    <g:form id = "all-form"  action="saveArticlePc" method="post"  id="${articlepcInstance.id}" class="form-style3">
                        <div class="form-item fix-width">
                            <label for="">当前文章<span class="tips"></span></label>
                            <div class="form-ctrl">
                                <input type="text" name="title" value='${articlepcInstance.title}' readonly="readonly"/>
                                <input type="hidden" name="tag" value='${articlepcInstance.tag}' readonly="readonly"/>
                            </div>
                        </div>
                        
                        <div class="form-item">
                            <label for="">文章内容</label>
                            <div class="form-ctrl">
                                <div class="adjoined-bottom">
									<div class="grid-container">
										<div class="grid-width-100">
											<div id="editor" name="projectDetail">
											
											</div>
										</div>
									</div>
								</div>
                            </div>
                            <input type="hidden" id="articleDetail" name="content" value="${articlepcInstance.content}">
                        </div>
                        <div class="form-item">
                            <div class="btn-container">
                                <Button class="btn btn-save-all">保存</Button>
                            </div>
                        </div>
                    </g:form>
                    
                </div>
            </div>                           
            	</div>
                	
                	
			</div>
			<div class="clearboth"></div>
		</section>


	</div>

	<script type="text/javascript">
	toolbar = ['title', 'bold', 'italic', 'underline', 'strikethrough', 'color', '|',
		       	 'ol', 'ul', 'blockquote', 'code', 'table', '|',
		       	  'link', 'image', 'hr', '|',
		       	   'indent', 'outdent', 'alignment'];
     var editor = new Simditor( {
            textarea : $('#editor'),
            placeholder : '这里输入内容...',
            toolbar : toolbar,  //工具栏
            defaultImage : 'simditor-2.0.1/images/image.png', //编辑器插入图片时使用的默认图片
            upload : {
                url : '/scfire/project/imgSave', //文件上传的接口地址
                params: null, //键值对,指定文件上传接口的额外参数,上传的时候随文件一起提交
                fileKey: 'fileDataFileName', //服务器端获取文件数据的参数名
                connectionCount: 3,
                leaveConfirm: '正在上传文件'
            } 
        });

		$(function() {
			editor.setValue($("#articleDetail").val());
			$('ul.nav.navbar-nav li').hover(
					function() {
						console.log($(this).index());
						$(this).siblings('.top-active').addClass(
								'position-' + $(this).index());
					},
					function() {
						$(this).siblings('.top-active').removeClass(
								'position-' + $(this).index());
			});
			//保存
	 		$('.btn-save-all').click(function(){
	 			//save context
	 			var data = editor.getValue();
	 	    	 $("#articleDetail").val(data);
		 		//this.html('saving...');
		 		this.click(function(){});
	 			 //if(!checkNull()){
	 			 	//return;
	 			//}
	 	    	 //console.log(data);
	 	         $("#all-form").submit();
	 	         
	 	    });
		});

		

	</script>

</body>
</html>